package com.jiyun.baobei.service.imp;

import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiyun.baobei.mapper.BaoBeiMapper;
import com.jiyun.baobei.mapper.LuyiinMapper;
import com.jiyun.baobei.service.BaoBeiService;
import com.jiyun.pojo.baobei.BaoBei;
import com.jiyun.pojo.baobei.BaoBeiVo;
import com.jiyun.pojo.luyin.Luyin;
import com.jiyun.pojo.result.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


/**
 * 文件名:BaoBeiServiceImp
 * 创建者: 闫俊涛
 * 创建时间:2022/6/25 20:54
 * 描述:这是一个实例
 */
@Service
public class BaoBeiServiceImp  extends ServiceImpl<BaoBeiMapper, BaoBei> implements BaoBeiService {
    @Autowired
    private BaoBeiMapper baoBeiMapper;
    @Autowired
    private LuyiinMapper luyiinMapper;


    @Override
    public ResultVo adto( BaoBei baoBei) {

        baoBeiMapper.insert(baoBei);
        System.out.println("添加的数据"+baoBei);
            return new ResultVo(200,"添加成功",baoBei);

        }

    /**
     * 历史
     * @return
     */
    @Override
    public List<BaoBeiVo>  listAll(Integer id) {
        List<BaoBeiVo> baoBeiVos = baoBeiMapper.listAll(id);
        return baoBeiVos;
    }

    @Override
    public ResultVo addfile(Luyin luyin) {

        baoBeiMapper.addfile(luyin);
        return new ResultVo(200,"添加成功",luyin);
    }

    /**
     *  今日
     * @return
     */
    @Override
    public List<BaoBeiVo> listAllJr(Integer id) {
        return baoBeiMapper.listAllJr(id);
    }

    /**
     * 明日
     * @param id
     * @return
     */
    @Override

    public List<BaoBeiVo> listAllMr(Integer id) {
        return baoBeiMapper.listAllMr(id);
    }

    @Override
    public ResultVo Tong(Integer id) {
      Integer tongjidai = baoBeiMapper.tongjidai(id);
        Integer tongjidaimianshi = baoBeiMapper.tongjidaimianshi(id);
        Integer  tongjinum = baoBeiMapper.tongjinum(id);
        Integer tongjigeshu = baoBeiMapper.tongjigeshu(id);
        HashMap<String ,Integer> objectObjectHashMap = new HashMap<>();
        objectObjectHashMap.put("num1",tongjidai);
        objectObjectHashMap.put("num2",tongjidaimianshi);
        objectObjectHashMap.put("num3",tongjinum);
        objectObjectHashMap.put("num4",tongjigeshu);
        return  new ResultVo(200,"成功",objectObjectHashMap);
    }



}
